<?php
class lappersediaandetail_model extends CI_Model{
	private $KodeStok;
	private $Quantity;
	private $Status;
	private $CreatedBy;
	private $CreatedOn;
	private $Active;

	private $tglAkhir;
	private $tglAwal;
	
	function setKodeStok($KodeStok){
		$this->KodeStok = $KodeStok;
	}
	function getKodeStok(){
		return $this->KodeStok;
	}
	
	function setQuantity($Quantity){
		$this->Quantity = $Quantity;
	}
	function getQuantity(){
		return $this->Quantity;
	}
	
	function setStatus($Status){
		$this->Status = $Status;
	}
	function getStatus(){
		return $this->Status;
	}

	function setCreatedBy($c_by){
		$this->createdby = $c_by;
	}
	function getCreatedBy(){
		return $this->createdby;
	}

	function setCreatedOn(){
		$dateNow = date('Y-m-d H:i:s');
		$this->createdon = $dateNow;
	}
	function getCreatedOn(){
		return $this->createdon;
	}
	
	function setActive($active_val){
		$this->Active = $active_val;
	}
	function getActive(){
		return $this->Active;
	}
	
	function setTanggalAwal($tglAwal){
		$this->tglAwal = $tglAwal;
	}
	function getTanggalAwal(){
		return $this->tglAwal;
	}
	
	function setTanggalAkhir($tglAkhir){
		$this->tglAkhir = $tglAkhir;
	}
	function getTanggalAkhir(){
		return $this->tglAkhir;
	}
	
	// Call the module constructor
	function __construct(){
		parent::__construct();
	}
	
	function getdetailstock($idkddet){
		$this->db->select()
			->where(array('transaction_stock.KodeStok'=>$idkddet,'transaction_stock.Active'=>'1'));
        $query = $this->db->get('transaction_stock');
        return $query->result();
	}
	
	function insert(){
		$data = array(
			'kodestok' => $this->getKodeStok(),
			'quantity' => $this->getQuantity(),
			'status' => $this->getStatus(),
			'createdby' => $this->getCreatedBy(),
			'createdon' => $this->getCreatedOn(),
			'active' => $this->getActive()
		);
		$this->db->insert('transaction_stock',$data);
	}
	
}